﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace NuMetaheuristics
{
    /// <summary>
    /// A class that performs an operation on an object of type <c>T</c>,
    /// directly modifying the object in the process.
    /// </summary>
    /// <typeparam name="T">The type of object to be operated on.</typeparam>
    public interface IUnaryOperator<T>
    {
        /// <summary>
        /// Perform an operation on the operand, modifying it in the process.
        /// </summary>
        /// <param name="operand">The object to be modified</param>
        void Operate(ref T operand);
    }

    /// <summary>
    /// A class that performs an operation using two objects of type
    /// <c>T</c>, producing a new object in the process. The original
    /// objects are not modified.
    /// </summary>
    /// <typeparam name="T">The type of the objects to use in the operation.</typeparam>
    public interface IBinaryOperator<T>
    {
        /// <summary>
        /// Perform an operation using two operands.
        /// </summary>
        /// <param name="operandL">The left-hand operand.</param>
        /// <param name="operandR">The right-hand operand.</param>
        /// <returns>The new object created as a result of the operation.</returns>
        T Operate(T operandL, T operandR);
    }
}
